<html>
<head>
	<script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
	<meta charset="utf-8">
	<title>我的文档</title>
<style type="text/css">
@media only screen and (min-width:1000px) {
	body{
		background-image: linear-gradient(to right,#12c2e9,#c471ed,#f64f59);
		width: 100%;
		height: 100%;
		margin: 0;
		text-align: center;
	}
	.ztl{
		width: 100%;
		height: 50px;
		border-radius: 10px;
		vertical-align: middle;
		background: white;
		opacity: 0.3;
		cursor: pointer;
	}
	.ztl a {
		margin-bottom: 0;
		color: white;
		position: absolute;
	}
	.wd{
		width: 30%;
		height: 300px;
		float: left;
		background: white;
		border-radius: 15px;
		margin-top: 1%;
		margin-left: 2%;
		margin-right: 1%;
		margin-bottom: 1%;
		text-align: center;
		overflow:hidden;
		text-overflow:ellipsis;
		z-index: 1;
	}
	.wd:hover{
		width: 30%;
		height: 300px;
		float: left;
		background: #99CCFF;
		border-radius: 15px;
		margin-top: 1%;
		margin-left: 2%;
		margin-right: 1%;
		margin-bottom: 1%;
		text-align: center;
		transition: 0.5s;
		cursor: pointer;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.wd p{
		color: red;
	}
	.ztl:hover{
		width: 100%;
		height: 50px;
		border-radius: 10px;
		vertical-align: middle;
		background-image: linear-gradient(to left,#12c2e9,#c471ed,#f64f59);
		opacity: 1;
		transition: 0.5s;
	}
	.ts{
		width: 50%;
		height: 600px;
		background: #28c7fa;
		margin: auto;
		border-radius: 25px;
		text-align: center;
		color: white;
		font-size: 50px;
	}
	.an{
		width: 20vw;
		height: 5vh;
		background-color: #12c2e9;
		margin: auto;
		margin-top: 1vh;
		border: none;
		border-radius: 10px;
		font-size: 20px;
		z-index: 2;
	}
	.wd img{
		z-index:2;
	}
	}
	@media only screen and (max-width:1000px) {
	body{
		background-image: linear-gradient(to right,#12c2e9,#c471ed,#f64f59);
		width: 100%;
		height: 100%;
		margin: 0;
	}
	.ztl{
		width: 100%;
		height: 50px;
		border-radius: 10px;
		vertical-align: middle;
		background: white;
		opacity: 0.3;
		cursor: pointer;
	}
	.ztl a {
		bottom: 0;
		color: white;
		position: absolute;
	}
	.wd{
		width: 45%;
		height: 30vh;
		float: left;
		background: white;
		border-radius: 15px;
		margin-top: 1%;
		margin-left: 2%;
		margin-right: 1.5%;
		margin-bottom: 1%;
		text-align: center;
		overflow:hidden;
		text-overflow:ellipsis;
		z-index: 1;
	}
	.wd p{
		color: red;
	}
	.wd img{
		z-index: 2;
	}
	.ztl:hover{
		width: 100%;
		height: 50px;
		border-radius: 10px;
		vertical-align: middle;
		background-image: linear-gradient(to left,#12c2e9,#c471ed,#f64f59);
		opacity: 1;
		transition: 0.5s;
	}
	.ts{
		width: 50%;
		height: 600px;
		background: #28c7fa;
		margin: auto;
		border-radius: 25px;
		text-align: center;
		color: white;
		font-size: 50px;
	}
	.an{
		width: 80%;
		height: 60px;
		background: #6666FF;
		margin: auto;
		color: #000000;
		font-size: 45px;
		margin-top: 40%;
		border-radius: 15px;
	}
	.ck{
	width:80%;
	height:3vh;
	background:#FF6633;
	margin:auto;
	border-radius:15px;
	font-size:30px;
	position:relative;
	bottom;110%;
	position: absolute;
	}
</style>
</head>
<body>
	<div class="ztl"><img src="img/fh.png" style="left: 0;position: absolute;" onclick="window.history.back()"></div>
	<?php
	header('Content-Type:text/html;charset=utf-8');
	//浏览目录并删除数组中的..和.
	require 'config.php';
	$lj=$pz['lj'];
	function arrdir($dir){
		if( is_dir($dir) ){
			if( $arr=scandir($dir) ){
				$sz=array();
				for($i=0;$i<count($arr);$i++){
					if($arr[$i]!='..' && $arr[$i]!='.'){
						array_push($sz,$arr[$i]);
					}
				}
				return $sz;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	$zy=$pz['host'].'tjwd.html';
	$user=$_COOKIE['user'];
	$pass=$_COOKIE['pass'];
	if($user=='' || $pass==''){
		echo '参数不完整';
	}else{
		if(is_dir("$lj/$user")){
			if($pass==file_get_contents("$lj/$user/mm")){
				$arr=arrdir("$lj/$user/api");
				if(count($arr)>0){
					for($i=0;$i<count($arr);$i++){
						$jg=$arr[$i];
						$bt=file_get_contents("$lj/$user/api/$jg/bt");
						$nr=file_get_contents("$lj/$user/api/$jg/nr");
						$sj=file_get_contents("$lj/$user/api/$jg/sj");
						$dz=$pz['host'].'get_wd.php/?z='.$user.'&w='.$jg;
						$wd=$pz['host'].'wd.php?id='.$jg;
						// <div class='an' onclick=window.location.href='".$wd."'>编辑</div><div class='an' onclick='sc(this)' id='".$jg."'>删除</div>
						echo "<div class='wd' title='( ＾∀＾）／欢迎＼( ＾∀＾）'><p style='float:left;background:#CCCCFF;border-radius:50%;width:10%;height:40px;margin-top:0;font-size:30px' title='文档ID'>".$jg."</p><img  title='删除文档' src='img/sc.png' style='float:right;' onclick='sc(this)' id='".$jg."'><img title='编辑文档' src='img/bj.png' style='float:right;margin-top:2%;' onclick=window.location.href='".$wd."'><h1 style='margin-left:20%'>".$bt."</h1><h3>".$nr."</h3><p>".$sj."</p><div class='an' onclick=window.location.href='".$dz."'>查看</div></div>";
					}
				}else{
					echo "<div class='ts'>提示<br>您还未创建文档，快去创建吧！(#^.^#)<div class='an' onclick=window.location.href='tj.php'>前往创建</div></div>";
				}
			}
		}
	}
	?>
</body>
</html>
<script type="text/javascript">
	function sc(obj){
		var id=obj.id;
		var tc=confirm("确定要删除吗？o(╥﹏╥)o");
		if(tc==true){
		var user=$.cookie('user');
		var pass=$.cookie('pass');
		if(user=='' || pass=='' || id==''){
			alert("参数不完整");
		}else{
			$.post('scwd.php',{
				user:user,
				pass:pass,
				id:id
			},
			function (data){
				alert(data);
				location.reload();
				loaction.history.back();
			}
			);
		}
	}else{
		alert("已成功取消该操作");
}
}
</script>
